package Chapter4;

//88页程序4.3
//按值传送
public class PassValueTest {
    private float ptValue;
    public void changeInt(int value){
        value=55;
    }
    public void changeStr(String value){
        value=new String("different");
    }
    public void changeObjValue(PassValueTest ref){
        ref.ptValue=99f;
    }
    public static void main(String[] args) {
        String str;
        int val;
        PassValueTest pt = new PassValueTest();
        val=11;
        pt.changeInt(val);
        System.out.println("Int值为："+val);
        str = new String("Hello");
        pt.changeStr(str);
        System.out.println("Str值为："+str);
        pt.ptValue=101f;
        pt.changeObjValue(pt);
        System.out.println("Current ptValue为："+pt.ptValue);
    }
}
